﻿<div style="background:#fbf9fe" ms-controller="TXSX">
    <div>
        <!--<div class="weui_cells_title">基本信息</div>-->
        <div class="weui_cells weui_cells_form">
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label label">提醒方式</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <select class="weui-select" name="conType" id="conType" ms-duplex="modelData.Type">
                        <option value="0">短信和微信</option>
                        <option value="1">短信</option>
                        <option value="2">微信</option>
                    </select>
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label label">提醒人</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input type="text" id="conFZR" placeholder="请选择提醒人" ms-duplex="modelData.TXUser" class="szhl szhl_getPeoples" />
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label label">提醒模式</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <select class="weui-select" ms-duplex="modelData.TXType">
                        <option value="1">仅一次</option>
                    </select>
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label label">提醒时间</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input type="text" id="rwEndTime" placeholder="截止时间" class="weui_input szhl szhl_require">
                </div>
            </div>
        </div>
        <div class="weui_cells_title">提醒内容</div>
        <div class="weui_cells weui_cells_form">
            <div class="weui_cell">
                <div class="weui_cell_hd" style="display:none;"><label class="weui_label label">提醒内容</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <textarea ms-duplex="modelData.TXContent" rows="5" placeholder="请输入内容" class="weui_textarea szhl szhl_require"></textarea>
                </div>
            </div>
        </div>
    </div>
</div>

<!--<div class="list-block" style="margin:0;" ms-controller="TXSX">
    <ul>
        <li>
            <div class="item-content">
                <div class="item-inner">
                    <div class="item-title label">提醒方式</div>
                    <div class="item-input">
                        <select name="conType" id="conType" ms-duplex="modelData.Type">
                            <option value="0">短信和微信</option>
                            <option value="1">短信</option>
                            <option value="2">微信</option>
                        </select>
                    </div>
                </div>
            </div>
        </li>
        <li>
            <div class="item-content">
                <div class="item-inner">
                    <div class="item-title label">提醒人</div>
                    <div class="item-input">
                        <input type="text" id="conFZR" placeholder="请选择提醒人" ms-duplex="modelData.TXUser" class="szhl szhl_getPeoples" />
                    </div>
                </div>
            </div>
        </li>
        <li>
            <div class="item-content">
                <div class="item-inner">
                    <div class="item-title label">提醒内容</div>
                    <div class="item-input">
                        <textarea ms-duplex="modelData.TXContent" rows="5" placeholder="请输入内容" class="szhl szhl_require" style="height:150px;overflow:auto;"></textarea>
                    </div>
                </div>
            </div>
        </li>
        <li>
            <div class="item-content">
                <div class="item-inner">
                    <div class="item-title label">提醒模式</div>
                    <div class="item-input">
                        <select class="form-control" ms-duplex="modelData.TXType">
                            <option value="1">仅一次</option>
                        </select>
                    </div>
                </div>
            </div>
        </li>
        <li>
            <div class="item-content">
                <div class="item-inner">
                    <div class="item-title label">提醒时间</div>
                    <div class="item-input">
                        <input type="text" id="rwEndTime" placeholder="截止时间" class="szhl szhl_require">
                    </div>
                </div>
            </div>
        </li>
    </ul>
</div>-->
<script>
    var tempmodel = avalon.define({
        $id: "TXSX",
        ColumnData: [],
        name: "日程提醒",
        iswf: false,//是否属于流程表单
        temptype: "edit", //edit,view
        tpData: [],
        dataid: "",
        wximg: "",
        plData: [],
        inittemp: function (strId, type) {
            if (type) {
                tempmodel.temptype = type;
            }
            if (strId) {
                tempmodel.dataid = strId;
                $.getJSON('/API/VIEWAPI.ashx?Action=TXSX_GETTXSXMODEL', { P1: strId }, function (resultData) {

                    if (resultData.ErrorMsg == "") {
                        tempmodel.modelData = resultData.Result;

                        if (tempmodel.modelData.Date) {
                            var ss = tempmodel.modelData.Date.split('-');
                            var hh = ss[0];
                            if (tempmodel.modelData.Hour.substring(0, 1) == "0") { tempmodel.modelData.Hour = tempmodel.modelData.Hour.substring(1, 1); }
                            $("#rwEndTime").datetimePicker({
                                value: [ss[0], ss[1], ss[2], tempmodel.modelData.Hour, tempmodel.modelData.Minute]
                            });
                        }

                        setTimeout(" ComFunJS.initForm()", 500);
                    }
                })
            } else {
                var dates = ComFunJS.getnowdate("yyyy-mm-dd-hh-mm").split('-');
                $("#rwEndTime").datetimePicker({
                    value: [dates[0], dates[1], dates[2], dates[3], dates[4]]
                });
                if (localStorage.getItem(pmodel.FormCode)) {//判断有没有未保存的表单
                    var tempdata = localStorage.getItem(pmodel.FormCode);//缓存表单数据
                    ComFunJS.winconfirm("系统检测到您未保存的数据,是否加载?", function () {
                        tempmodel.modelData = $.parseJSON(tempdata);
                        ComFunJS.initForm();
                    }, function () {
                        localStorage.removeItem(pmodel.FormCode);
                        ComFunJS.initForm();
                    })
                } else {
                    ComFunJS.initForm();
                }

            }
        },//初始化
        modelData: { "Type": "2", "TXUser": "", "TXContent": "", "TXType": "1", "Days": "01", "Date": "", "Hour": "08", "Minute": "00", "CFType": "1", "CFCount": "", "CFJZDate": "" },
        SaveData: function (callback) {
            if (tempmodel.modelData.TXType == "1") {

                var dd = $("#rwEndTime").val().split(' ')[0];
                var hh = $("#rwEndTime").val().split(' ')[1];


                tempmodel.modelData.Date = dd;
                tempmodel.modelData.Hour = hh.split(':')[0];
                tempmodel.modelData.Minute = hh.split(':')[1];
            }

            $.post("/API/VIEWAPI.ashx?ACTION=TXSX_ADDTXSX", { P1: JSON.stringify(tempmodel.modelData.$model), P2: tempmodel.wximg }, function (result) {

                return callback.call(this, $.parseJSON(result));
            });

        },
        Complate: function () {
            window.location.href = "/View_Mobile/UI/UI_TXSX_LIST.html?r=" + Math.random();
        }

    });//@ sourceURL=MTXSX.js;
    tempmodel.modelData.$watch("TXContent", function (a, b) {
        if (!pmodel.DataID) {
            localStorage.setItem(pmodel.FormCode, JSON.stringify(tempmodel.modelData.$model));
        }
    })
</script>